#ifndef __RAY_3_HPP__
#define __RAY_3_HPP__

#include "Vector3.hpp"
#include "BoundingBox.hpp"
#include "Plane.hpp"

namespace PocketSurvival::Engine
{
    struct Ray3
    {
        Vector3 Position;
        Vector3 Direction;

        constexpr Ray3() noexcept;
        constexpr Ray3(const Vector3 &position, const Vector3 &direction) noexcept;

        bool Intersection(const BoundingBox &box, float &outValue) const;
        bool Intersection(const Plane &plane, float &outValue) const;

        friend constexpr inline bool operator==(const Ray3 &left, const Ray3 &right)
        {
            return (left.Position == right.Position) && (left.Direction == right.Direction);
        }
        friend constexpr inline bool operator!=(const Ray3 &left, const Ray3 &right)
        {
            return !(left == right);
        }
    };
    
    constexpr Ray3::Ray3() noexcept : Position(0), Direction(0) {}
    constexpr Ray3::Ray3(const Vector3 &position, const Vector3 &direction) noexcept : Position(position), Direction(direction) {}

} // namespace PocketSurvival

#endif
